FROM golang:1.24.11-bookworm as build_env

ENV CGO_ENABLED=0
WORKDIR /app
COPY *.go go.mod ./
RUN go get -d -v && go build -o tester .

FROM golang:1.24.11-bookworm as fortio_build_env

WORKDIR /fortio
ADD "https://api.github.com/repos/dapr/fortio/branches/v1.38.4-dapr" skipcache
RUN git clone https://github.com/dapr/fortio.git
RUN cd fortio && git checkout v1.38.4-dapr && go build

FROM debian:bookworm-slim
WORKDIR /
COPY --from=build_env /app/tester /
COPY --from=fortio_build_env /fortio/fortio/fortio /usr/local/bin/fortio
CMD ["/tester"]
